package com.neo.users.UserInfoA.controller;

import com.neo.users.UserInfoA.pojo.UserInfoA;
import com.neo.users.UserInfoA.service.UserInfoAService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/**
* 用户A类型表，用于测试mp代码生成 控制类
* @author chenb
* @date 2024-08-29
*/
@Api(value = "UserInfoAController",tags = "用户A类型表，用于测试mp代码生成")
  @RestController
@RequestMapping("userInfoAService")
public class UserInfoAController {

@Autowired
private UserInfoAService userInfoAService;

@ApiOperation("新增_用户A类型表，用于测试mp代码生成")
@PostMapping("/addUserInfoA")
public String addUserInfoA(@RequestBody UserInfoA userInfoA) {

String massage = userInfoAService.addUserInfoA(userInfoA);
return  massage;
}
@ApiOperation("删除_用户A类型表，用于测试mp代码生成（通过序列ID）")
@DeleteMapping(value = "/deleteUserInfoA/{id}")
public String deleteUserInfoA(@NotNull @PathVariable Integer id) {

String massage = userInfoAService.deleteUserInfoA(id);
return massage;
}

@ApiOperation("修改_用户A类型表，用于测试mp代码生成")
@PutMapping("updateUserInfoA")
public String updateUserInfoA(@Valid @RequestBody UserInfoA userInfoA) {

String massage = userInfoAService.updateUserInfoA(userInfoA);
return massage;
}

@ApiOperation("查询列表_用户A类型表，用于测试mp代码生成：{列表}")
@ApiImplicitParams({
      @ApiImplicitParam(name = "categoryId", value = "类别id", dataType = "Integer"),
      @ApiImplicitParam(name = "goodsName", value = "物品名称（如：酸奶，护手霜）", dataType = "String"),
      @ApiImplicitParam(name = "shelfLifeQuantity", value = "保质期数量（保质期=保质期数量x保质期单位）", dataType = "Integer"),
      @ApiImplicitParam(name = "shelfLifeUnit", value = "保质期单位（1年，2季度，3月，4日，5周，6天，7时，8分）", dataType = "String"),
      @ApiImplicitParam(name = "ext1", value = "备注字段1", dataType = "String"),
      @ApiImplicitParam(name = "ext2", value = "备注字段2", dataType = "String"),
      @ApiImplicitParam(name = "ext3", value = "备注字段3", dataType = "String"),
      @ApiImplicitParam(name = "isDel", value = "是否删除（0未删除，1已删除）", dataType = "String"),
@ApiImplicitParam(name = "limit", value = "查询多少行", dataType = "Integer"),
@ApiImplicitParam(name = "offset", value = "起始查询位置", dataType = "Integer")
})
@GetMapping("getUserInfoAList")
public String getUserInfoAList(
      @RequestParam(name="categoryId", required = false) Integer categoryId,
      @RequestParam(name="goodsName", required = false) String goodsName,
      @RequestParam(name="shelfLifeQuantity", required = false) Integer shelfLifeQuantity,
      @RequestParam(name="shelfLifeUnit", required = false) String shelfLifeUnit,
      @RequestParam(name="ext1", required = false) String ext1,
      @RequestParam(name="ext2", required = false) String ext2,
      @RequestParam(name="ext3", required = false) String ext3,
      @RequestParam(name="isDel", required = false) String isDel,
@RequestParam(name="limit",required = false)Integer limit,
@RequestParam(name="offset",required = false)Integer offset){

String massage = userInfoAService.getUserInfoAList(categoryId,goodsName,shelfLifeQuantity,shelfLifeUnit,ext1,ext2,ext3,isDel,limit,offset);
return massage;
}

@ApiOperation("查询数量_用户A类型表，用于测试mp代码生成：{数量}")
@ApiImplicitParams({
      @ApiImplicitParam(name = "categoryId", value = "类别id", dataType = "Integer"),
      @ApiImplicitParam(name = "goodsName", value = "物品名称（如：酸奶，护手霜）", dataType = "String"),
      @ApiImplicitParam(name = "shelfLifeQuantity", value = "保质期数量（保质期=保质期数量x保质期单位）", dataType = "Integer"),
      @ApiImplicitParam(name = "shelfLifeUnit", value = "保质期单位（1年，2季度，3月，4日，5周，6天，7时，8分）", dataType = "String"),
      @ApiImplicitParam(name = "ext1", value = "备注字段1", dataType = "String"),
      @ApiImplicitParam(name = "ext2", value = "备注字段2", dataType = "String"),
      @ApiImplicitParam(name = "ext3", value = "备注字段3", dataType = "String"),
      @ApiImplicitParam(name = "isDel", value = "是否删除（0未删除，1已删除）", dataType = "String"),
})
@GetMapping("getUserInfoACount")
public String getUserInfoACount(
      @RequestParam(name = "categoryId", required = false) Integer categoryId,
      @RequestParam(name = "goodsName", required = false) String goodsName,
      @RequestParam(name = "shelfLifeQuantity", required = false) Integer shelfLifeQuantity,
      @RequestParam(name = "shelfLifeUnit", required = false) String shelfLifeUnit,
      @RequestParam(name = "ext1", required = false) String ext1,
      @RequestParam(name = "ext2", required = false) String ext2,
      @RequestParam(name = "ext3", required = false) String ext3,
      @RequestParam(name = "isDel", required = false) String isDel) {

String massage = userInfoAService.getUserInfoACount(categoryId, goodsName, shelfLifeQuantity, shelfLifeUnit, ext1, ext2, ext3, isDel);
return massage;
}

}

